function auc=roc_max(dt)


if isnumeric(dt)
    % In case we are getting it all in a single matrix
    dtt.x=dt(:,1:end-1);
    dtt.y=dt(:,end);
    for i=1:length(dtt.x(1,:))
        dtt.vars{i}=['Var#',num2str(i)];
    end
    dt=dtt;
elseif ischar(dt)
    % If Excell spreadsheet is provided as filename
    dt=create_dt(dt);    
end




%ROCmax calculates ROC for all indepednet variables by themselves
n=length(dt.x(1,:));
auc=zeros(n,1);

for i=1:n
    figure(i);
    [auc(i),MC(i,:)]=roc(dt.y,dt.x(:,i),3);
    disp([num2str(i),' (',dt.vars{i},'): AUC=',num2str(auc(i)),'; segment ',num2str(MC(i,1)),' --> missClass=',num2str(MC(i,4)*100,2),'% truePos=',num2str(MC(i,3)*100,2),'% falseNeg=',num2str(MC(i,2)*100,2),'%'])
    title(dt.vars{i});
    set(gcf,'Position',[100+10*i 300-10*i 300 300]);    
end
[lele,Ind]=max(auc);
disp(['Highest AUC found for variable #',num2str(Ind),': ',dt.vars{Ind}])
    